--
--	Resource Distribution 2 Tab Module and Tool Helper
--

include("caf_core/shared/RD2_Tools.lua")
--include("caf_core/shared/tool_helpers.lua")
--include("caf_core/shared/tool_manifest.lua")

local usetab = CreateClientConVar( "CAF_UseTab", "1", true, false )

local function CAFTab()
	if usetab:GetBool() then
		spawnmenu.AddToolTab( "Custom Addon Framework", "Custom Addon Framework" )
	end
end
hook.Add( "AddToolMenuTabs", "CAFTab", CAFTab)

--put this in your tool to support the tab
----if not ( RES_DISTRIB == 2 ) then Error("Please Install Resource Distribution 2 Addon.'" ) return end
--if (CLIENT and GetConVarNumber("CAF_UseTab") == 1) then TOOL.Tab = "Custom Addon Framework" end

function RD2_BuildCPanel( cp, toolname, listname, custom )
	--cp:AddControl( 'Header', { Text = '#Tool_'..toolname..'_name', Description	= '#Tool_'..toolname..'_desc' })  
	cp:AddControl("CheckBox", { Label = "Don't Weld", Command = toolname.."_DontWeld" })
	cp:AddControl("CheckBox", { Label = "Allow welding to world", Command = toolname.."_AllowWorldWeld" })
	cp:AddControl("CheckBox", { Label = "Make Frozen", Command = toolname.."_Frozen" })
	local ListControl = vgui.Create( "RD2Control" )
	cp:AddPanel( ListControl )
	ListControl:SetList( toolname, listname )
end

